IO.popen behaving strangely within SU
-
Hi all -
I am trying to run a subprocess from a shell command using
IO.popen(have also triedKernel#systemwith identical results), and I'm getting odd behavior. Here's my code:curl = "curl " curl += "--cookie \"JSESSIONID=#{@sessionid}\" " curl += "-H \"Content-type;application/octet-stream\" " curl += "-X POST " curl += "-o \"#{responseFile}\" " curl += "--data-binary \"@#{filename}\" " curl += "\"#{url}\"" puts "command; #{curl}" IO.popen(curl, "r") { |out| out.readlines } # Script never makes it to hereIt's a streaming file upload using
curl. Curl starts uploading, sends about 100kb, which is received by my server, and suddenly the stream ends ("unexpected end of stream error" on the server-side). Curl keeps running endlessly, sending zero data after that. Since I'm blocking withreadlines, SU is forever frozen from then on...I have tried this same code in a standalone script as well as running the command directly from a shell, and both work fine.
Anyone encountered this before? SU doesn't seem to like subprocesses...
EDIT: I should note this is on OSX.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement