Giter Club home page Giter Club logo

Comments (4)

jtojnar avatar jtojnar commented on September 28, 2024

This simplified code exhibits the behaviour

use std::process::Command;

fn main() {
    execute(String::from("bash -i -c rrun"));
}

fn execute(cmd: String) {
    match Command::new("bash").arg("-c").arg(&cmd).spawn() {
        Ok(_) => println!("Ok"),
        Err(e) => println!("Error: {}", e),
    }
}

while when I use execute(String::from("bash -c rrun")); it works correctly.

from rrun.

buster avatar buster commented on September 28, 2024

Did you try to change the config in ~/.config/rrun/config.toml?

Especially this part:

[[runner]]
type="command"
command="bash -i -c '(history -s {}; history -a) && {}'"

from rrun.

jtojnar avatar jtojnar commented on September 28, 2024

No, it does not work for me with the default config. And I had not much luck trying to come up with better one.

from rrun.

jtojnar avatar jtojnar commented on September 28, 2024

Some more details when I run rrun and enter true:

$ ps -o pid,state=,command | grep bash
14095 R bash -i -c (history -s true; history -a) && true
$ sudo strace -p 14095
strace: Process 14095 attached
--- SIGTTIN {si_signo=SIGTTIN, si_code=SI_USER, si_pid=14095, si_uid=1000} ---
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x7f99a80540b0}, {SIG_DFL, [], SA_RESTORER, 0x7f99a80540b0}, 8) = 0
ioctl(255, TIOCGPGRP, [9375])           = 0
rt_sigaction(SIGTTIN, {SIG_DFL, [], SA_RESTORER, 0x7f99a80540b0}, {SIG_IGN, [], SA_RESTORER, 0x7f99a80540b0}, 8) = 0
kill(0, SIGTTIN)                        = 0

The SIGTTIN keeps repeating.

Now if I exit the terminal I opened the rrun in, the called application finally runs. This is the strace output after exiting the terminal:

--- SIGTTIN {si_signo=SIGTTIN, si_code=SI_USER, si_pid=14095, si_uid=1000} ---
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x7f99a80540b0}, {SIG_DFL, [], SA_RESTORER, 0x7f99a80540b0}, 8) = 0
ioctl(255, TIOCGPGRP, 0x7ffeddec30ec)   = -1 EIO (Input/output error)
setpgid(0, 14095)                       = 0
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
ioctl(255, TIOCSPGRP, [14095])          = -1 ENOTTY (Inappropriate ioctl for device)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
setpgid(0, 14055)                       = -1 EPERM (Operation not permitted)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2997, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2997
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/share/locale/en_GB.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_GB.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_GB/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
open("/usr/share/locale/en_GB.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_GB.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_GB/LC_MESSAGES/libc.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1474, ...}) = 0
mmap(NULL, 1474, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f99a8c9b000
close(3)                                = 0
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "bash: cannot set terminal proces"..., 80) = -1 EIO (Input/output error)
write(2, "bash: no job control in this she"..., 35) = -1 EIO (Input/output error)
fcntl(255, F_SETFD, FD_CLOEXEC)         = 0
rt_sigaction(SIGCHLD, {0x43eff0, [], SA_RESTORER|SA_RESTART, 0x7f99a80540b0}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f99a80540b0}, 8) = 0
ioctl(255, TCGETS, 0x7ffeddec30b0)      = -1 EIO (Input/output error)
getrlimit(RLIMIT_NPROC, {rlim_cur=31485, rlim_max=31485}) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("/etc/bash.bashrc", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=603, ...}) = 0
read(3, "#\n# /etc/bash.bashrc\n#\n\n# If not"..., 603) = 603
close(3)                                = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
faccessat(AT_FDCWD, "/usr/share/bash-completion/bash_completion", R_OK) = 0
open("/usr/share/bash-completion/bash_completion", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=70243, ...}) = 0
brk(0x14c7000)                          = 0x14c7000
read(3, "#                               "..., 70243) = 70243
close(3)                                = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
brk(0x14e8000)                          = 0x14e8000
brk(0x1509000)                          = 0x1509000
stat("/etc/rc.d/init.d", 0x7ffeddec2000) = -1 ENOENT (No such file or directory)
stat("/etc/init.d", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/etc/slackware-version", 0x7ffeddec2220) = -1 ENOENT (No such file or directory)
open("/etc/init.d/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
brk(0x152a000)                          = 0x152a000
getdents(3, /* 3 entries */, 32768)     = 80
getdents(3, /* 0 entries */, 32768)     = 0
brk(0x1522000)                          = 0x1522000
close(3)                                = 0
faccessat(AT_FDCWD, "/etc/init.d/laptop-mode", X_OK) = 0
brk(0x1543000)                          = 0x1543000
brk(0x1564000)                          = 0x1564000
stat("/etc/bash_completion.d", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
faccessat(AT_FDCWD, "/etc/bash_completion.d", R_OK) = 0
faccessat(AT_FDCWD, "/etc/bash_completion.d", X_OK) = 0
open("/etc/bash_completion.d/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(3, /* 3 entries */, 32768)     = 80
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
stat("/etc/bash_completion.d/optirun", {st_mode=S_IFREG|0644, st_size=1870, ...}) = 0
faccessat(AT_FDCWD, "/etc/bash_completion.d/optirun", R_OK) = 0
open("/etc/bash_completion.d/optirun", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1870, ...}) = 0
read(3, "# bash completion for bumblebee\n"..., 1870) = 1870
close(3)                                = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fcntl(1, F_GETFD)                       = 0
fcntl(1, F_DUPFD, 10)                   = 10
fcntl(1, F_GETFD)                       = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
dup2(3, 1)                              = 1
close(3)                                = 0
fcntl(2, F_DUPFD, 10)                   = 11
fcntl(2, F_GETFD)                       = 0
fcntl(11, F_SETFD, FD_CLOEXEC)          = 0
dup2(1, 2)                              = 2
stat(".", {st_mode=S_IFDIR|0701, st_size=24576, ...}) = 0
stat("/home/jtojnar/gocode/bin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/home/jtojnar/.cabal/bin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/home/jtojnar/.stack/programs/x86_64-linux/ghc-7.10.1/bin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/usr/local/heroku/bin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/home/jtojnar/.local/bin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/home/jtojnar/bin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/usr/local/sbin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/usr/local/bin/optirun", 0x7ffeddec1350) = -1 ENOENT (No such file or directory)
stat("/usr/sbin/optirun", {st_mode=S_IFREG|0755, st_size=44600, ...}) = 0
stat("/usr/sbin/optirun", {st_mode=S_IFREG|0755, st_size=44600, ...}) = 0
geteuid()                               = 1000
getegid()                               = 100
getuid()                                = 1000
getgid()                                = 100
access("/usr/sbin/optirun", X_OK)       = 0
stat("/usr/sbin/optirun", {st_mode=S_IFREG|0755, st_size=44600, ...}) = 0
geteuid()                               = 1000
getegid()                               = 100
getuid()                                = 1000
getgid()                                = 100
access("/usr/sbin/optirun", R_OK)       = 0
stat("/usr/sbin/optirun", {st_mode=S_IFREG|0755, st_size=44600, ...}) = 0
stat("/usr/sbin/optirun", {st_mode=S_IFREG|0755, st_size=44600, ...}) = 0
geteuid()                               = 1000
getegid()                               = 100
getuid()                                = 1000
getgid()                                = 100
access("/usr/sbin/optirun", X_OK)       = 0
stat("/usr/sbin/optirun", {st_mode=S_IFREG|0755, st_size=44600, ...}) = 0
geteuid()                               = 1000
getegid()                               = 100
getuid()                                = 1000
getgid()                                = 100
access("/usr/sbin/optirun", R_OK)       = 0
fstat(1, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 3), ...}) = 0
ioctl(1, TCGETS, 0x7ffeddec0d10)        = -1 ENOTTY (Inappropriate ioctl for device)
write(1, "optirun is /usr/sbin/optirun\n", 29) = 29
dup2(11, 2)                             = 2
fcntl(11, F_GETFD)                      = 0x1 (flags FD_CLOEXEC)
close(11)                               = 0
dup2(10, 1)                             = 1
fcntl(10, F_GETFD)                      = 0x1 (flags FD_CLOEXEC)
close(10)                               = 0
faccessat(AT_FDCWD, "/home/jtojnar/.bash_completion", R_OK) = -1 ENOENT (No such file or directory)
open("/home/jtojnar/.bashrc", O_RDONLY) = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f99a8c5f9d0) = 14358
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {0x43bec0, [], SA_RESTORER, 0x7f99a80540b0}, {0x455dd0, [], SA_RESTORER, 0x7f99a80540b0}, 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 14358
rt_sigaction(SIGINT, {0x455dd0, [], SA_RESTORER, 0x7f99a80540b0}, {0x43bec0, [], SA_RESTORER, 0x7f99a80540b0}, 8) = 0
ioctl(255, TCGETS, 0x7ffeddec2d90)      = -1 EIO (Input/output error)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=14358, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
wait4(-1, 0x7ffeddec27d0, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[]})                 = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
ioctl(255, TIOCSPGRP, [14055])          = -1 ENOTTY (Inappropriate ioctl for device)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
setpgid(0, 14055)                       = -1 EPERM (Operation not permitted)
exit_group(0)                           = ?
+++ exited with 0 +++

from rrun.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.