Skip to content

Automatic code object creation can fail if another process writes to the subshell #100

@ConradJohnston

Description

@ConradJohnston

When aiida-shell runs with some arbitrary command, like cat, an AiiDA code object is created automatically.

Part of this process is calling which to get the path to the arbitrary command:
https://github.com/sphuber/aiida-shell/blob/2ab82195b755cfc6d814439a72670632d2e025ff/src/aiida_shell/launch.py#L131

On my machine, I've seen a helpful warning from a sysadmin process being written to the subshell on invocation, and thus this bonus message get prepended to the output of which. This then ends up in the _aiidasubmit.sh script written by _prepareforsubmission.

An example of the created faulty code is like this:

> verdi code show foo
-----------------------  ---------------------------------------------------------------
PK                       42
UUID                     8b7a85b4-54b4-4080-b270-3ecf58163e18
Type                     core.code.installed.shell
Label                    obabel
Description
Default calc job plugin  core.shell
Use double quotes        False
With mpi
Prepend text
Append text
Computer                 localhost (localhost), pk: 2
Filepath executable      WARNING:  helpful sysadmin message
                         /some/correct/path/foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions