Skip to content

Restarting msjnc with a connected session can't find the pid #13

@wangmaster

Description

@wangmaster

Here's the log snippet:

2013-09-17 09:34:13-0500: MadScientist JNC Session Manager 2.5 (17 Feb 2013)
2013-09-17 09:34:13-0500: Session: Change from Disconnected to Connected
2013-09-17 09:34:13-0500: Session: Log says Connected, but no PID: disconnecting.

Here's where it's failing:

sub _getpid {
    my $arg = $_[0] ? "-p '$_[0]'" : '-e';
    # This appears to be the most portable option.
    # Kind of gross that we may have to run ps(1) on every update, but...
    local $_ = `ps $arg -o pid= -o comm=`;
    return m,^\s*(\d+)\s(?:.*/)?ncsvc$, ? $1 : 0;
}

I don't understand why it's failing though. If I move the begin/end line (^ $) on the return regex everything works fine.

Fedora 19:
perl --version:
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
ps --version
procps-ng version 3.3.8

In case it's relevant. But as far as I can tell the ps output does have begin and end of line.

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