Questions tagged [popen3]

Open3 grants you access to stdin, stdout, stderr and a thread to wait the child process when running another program.

Open3 grants you access to stdin, stdout, stderr and a thread to wait the child process when running another program

69 questions
3
votes
2 answers

Ruby Open3.popen3 simulate user input

I am trying to run a bash script (@command) that requires user input and I'm trying to feed that script input using the following code: Open3.popen3(@command) do |stdin, stdout, stderr| stdin.write("y") stdout.gets end Here is an idea of the…
anthv123
  • 523
  • 1
  • 8
  • 20
3
votes
3 answers

Python equivalent to find -exec

I'm trying to run this BASH command in Popen: find /tmp/mount -type f -name "*.rpmsave" -exec rm -f {} \; But every time I get: "find: missing argument to `-exec'\n" in stderr. What would the python equivalent of this be? My naive aproach would…
steve-gregory
  • 7,396
  • 8
  • 39
  • 47
3
votes
0 answers

Using Ruby's popen3 or equivalent on Windows

I'm making a Vim plugin that uses Open3.popen3 to run a shell command, and I need the result and exit code. It works fine on Linux, but freezes on Windows. I've checked on pry under Windows and whenever I run Open3.popen3 or Process.spawn the shell…
Idan Arye
  • 12,402
  • 5
  • 49
  • 68
2
votes
1 answer

Why does xelatex not want to be called by popen3 in vararg form?

Take this minimal LaTeX document: % minimal.tex \documentclass{article} \begin{document} Hello World! \end{document} And this Ruby (2.5.1) script: require 'open3' Open3.popen3( 'xelatex', '-interaction=nonstopmode', '"minimal.tex"' ) do…
Raphael
  • 9,779
  • 5
  • 63
  • 94
2
votes
3 answers

Open3.popen3 returns wrong error Errno::ENOENT on Windows

I have the following code in test.rb: require 'open3' cmd = 'C:\Program Files\foo\bar.exe' Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr| puts "stdout: #{stdout.read}" puts "\n\n" puts "stderr: #{stderr.read}" end bar.exe is a console…
dhrubo_moy
  • 1,144
  • 13
  • 31
2
votes
2 answers

Mocking popen3 block form ruby

I am developing some test cases in Ruby using rspec. I am attempting to mock the popen3 function. However, while still keeping the blocking form, I am unable to capture the expected output information: Class MyClass def execute_command …
Parth
  • 1,226
  • 7
  • 28
  • 49
2
votes
1 answer

IPC::Open3 run snmpwalk with different behavior than standalone snmwalk command

I have made a custom sub to run various terminal-command in perl using Open3. I encounter a strange problem with snmpwalk, when i run the command in terminal it work, but with Open3 it won't. The sub is this: sub run_cmd { my ( $cmd, @args ) =…
2
votes
3 answers

Use stderr in lua io.popen to determine faulty function call

I'm making a function that can read the metadata of the current song playing in spotify. This is being programmed in lua since it is an implementation for awesome wm. I got the following line to get all the metadata that I can later use. handle =…
Hoogendijk
  • 100
  • 1
  • 10
1
vote
1 answer

Suppressing Command Prompt output while running a shell command in capture3

I'm running Amazon's Kindle Previewer tool in a Ruby script through capture3. The Kindle Previewer command validates an epub file and prints a log to a specified folder, while also printing a log in the terminal as it runs. I do not want any of…
lumos
  • 161
  • 12
1
vote
0 answers

Ruby deadlock waiting on Process::Waiter with Open3.popen3

I was using Open3.capture3 in my ruby code and started to notice deadlocks. I did some research and came across this great blog about how open3 can cause deadlocks. Taking this into account I came up with my own capture3 method (still using…
Nick Hyland
  • 357
  • 1
  • 10
1
vote
1 answer

Track progress of dd command called using open3 in ruby

I am trying to monitor the progress of copying a raspberry-pi OS image to a microSD card. This is similar to Kill a process called using open3 in ruby, except I'm not killing the process, I'm sending it a command for it to issue a progress message. …
1
vote
1 answer

Real-time output of a rake task with popen3

It seems impossible to run a rake task from within a popen3 block while getting real-time output. All lines come at once at the end of the rake task. I'm trying to get real-time output from rake tasks though a popen3 block cmd = 'rake…
Benjamin Bouchet
  • 12,971
  • 2
  • 41
  • 73
1
vote
1 answer

Running multi-threaded Open3 call in Ruby

I have a large loop where I'm trying to run the call to Open3.capture3 in threads instead of running linearly. Each thread should run independently and there's no deadlock in terms of accessing data. The issue is, the threaded version is so much…
aonemd
  • 331
  • 3
  • 13
1
vote
0 answers

Ruby popen3 - How to prevent that repeatedly writing to stdin results in a timeout?

Currently I'm writing to stdin in a loop when stdout provides me with the last line marker "EE\n". Now it should go on until the loop is terminated but for some reason stdout is not providing any new lines at iteration 625 and so on, I think the…
Sebas
  • 11
  • 3
1
vote
0 answers

node-sass module install script does not exit when npm install is launched by Ruby's popen3

UPDATE 3: This problem appears to be a part of the module installation of node-sass. The stranded process has a working directory of ./node_modules/node-sass, and its command-line scripts/install.js resolves to a file within the module. Furthermore,…
Jonathan Gilbert
  • 3,526
  • 20
  • 28