enkessler / childprocess

Cross-platform Ruby library for managing child processes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add signal selection when stopping the process

pevtsoff opened this issue · comments

Hi Erik,

If this is possible, would you please add a feature to be able to state a signaly type sent when stopping the process. like this
1.Default stop would still go without parameters and would behave as it does now, which is very good rally
Process(stop)
2.But in case you want to send some particular signal from this ruby list (Signal.list in IRB)
{"EXIT"=>0, "INT"=>2, "ILL"=>4, "ABRT"=>22, "FPE"=>8, "KILL"=>9, "SEGV"=>11, "TERM"=>15}
It would be possible to call stop with parameter like
@process.stop(:sig_int) or
@process.stop(Signal.list['EXIT']) whichever is more appropriat`e for Ruby conventions

This would really help to use this package for automated application testing, as we would need to test like a case that the process finishes gracefully when CTRL+C (INT signal) is received by the process. And I think it would add more flexibility for testing purpose anyway

Thanks a lot
Ivan

In particular, I'm interested in INT and may be TERM signal, so that I can test if it's correctly handled by our apps in auto test framework

@pevtsoff , I'm not sure that this can be done. Signal.list does not seem to limit its signals based on what the operating system will accept. Process#kill seems to only accept KILL as a valid signal for Windows and after digging around in the project history, the only supported Windows signals seem to be INT, BREAK, and KILL since the project first started. Looking around online, it seems that Windows does not support signals in the same way that Unix-like systems do. Interrupting and breaking may be as graceful as one can get with Windows.

Have you actually successfully sent a TERM signal to a Windows process?

@pevtsoff I haven't made any progress on this and I don't have any more time to dedicate to investigating it, unfortunately. You can keep poking at it if you want to and if you come up with something then I'm happy to look at a PR. For the moment, however, I'm closing the issue because all signs point to arbitrary signals not being possible on Windows.