Skip to content

Subprocess spawned from inside shell does not stop when shell.interrupt() or shell.shutdown() is called. #27

@cryptrr

Description

@cryptrr

I am running a python script using shell.run()

But even after interrupt() or even shutdown(), the subprocess spawned inside the python script still keeps running.

val result = shell.run(command)

Timber.d("Exit Code ${result.exitCode}") //Correctly receives non zero exit code.

Is this an issue with signal forwarding or am I doing anything wrong?

init {
          main.viewModelScope.launch {
              main.eventFlow.collect{
                  when(it){
                      is ViewModelEvent.CancelProcess -> {
                          CoroutineScope(Dispatchers.IO).launch {
                              //Event is fired
                              shell.interrupt()
                       }
                     }
                     else -> {}
                }
           }
      }
 }

shell = Shell("/path/to/sh")

fun runCommandForShareWithEnv(command: String){
     CoroutineScope(Dispatchers.IO).launch{
         val result = shell.run(command)
         Timber.d("Exit Code ${result.exitCode}") //Correctly receives non zero exit code.
     }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions