Merge pull request #10067 from reitermarkus/sudo-prompt
Fix `sudo` prompt.
This commit is contained in:
commit
3f6a930044
@ -167,7 +167,7 @@ class SystemCommand
|
|||||||
options = {
|
options = {
|
||||||
# Create a new process group so that we can send `SIGINT` from
|
# Create a new process group so that we can send `SIGINT` from
|
||||||
# parent to child rather than the child receiving `SIGINT` directly.
|
# parent to child rather than the child receiving `SIGINT` directly.
|
||||||
pgroup: true,
|
pgroup: sudo? ? nil : true,
|
||||||
}
|
}
|
||||||
options[:chdir] = chdir if chdir
|
options[:chdir] = chdir if chdir
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ class SystemCommand
|
|||||||
|
|
||||||
@status = raw_wait_thr.value
|
@status = raw_wait_thr.value
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
Process.kill("INT", pid) if pid
|
Process.kill("INT", pid) if pid && !sudo?
|
||||||
raise Interrupt
|
raise Interrupt
|
||||||
rescue SystemCallError => e
|
rescue SystemCallError => e
|
||||||
@status = $CHILD_STATUS
|
@status = $CHILD_STATUS
|
||||||
|
|||||||
@ -55,7 +55,7 @@ describe SystemCommand do
|
|||||||
.to receive(:popen3)
|
.to receive(:popen3)
|
||||||
.with(
|
.with(
|
||||||
an_instance_of(Hash), ["/usr/bin/sudo", "/usr/bin/sudo"], "-E", "--",
|
an_instance_of(Hash), ["/usr/bin/sudo", "/usr/bin/sudo"], "-E", "--",
|
||||||
"/usr/bin/env", "A=1", "B=2", "C=3", "env", *env_args, pgroup: true
|
"/usr/bin/env", "A=1", "B=2", "C=3", "env", *env_args, pgroup: nil
|
||||||
)
|
)
|
||||||
.and_wrap_original do |original_popen3, *_, &block|
|
.and_wrap_original do |original_popen3, *_, &block|
|
||||||
original_popen3.call("true", &block)
|
original_popen3.call("true", &block)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user