You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nushell breaks gdb workflow because of the lack of buildin exec command #1799
Describe the bug
Hi, I just started to use nushell and it seems very promising. However, I noticed a problem when I try to debug a piece of C++ code, and gdb stop working (in the terminal and in IDEs). Apparently gdb run depends on the shell builtin exec command, and nu does not support that command.
I am not sure what should be the solution to this problem. I tried to define an alias
alias exec [c] { "echo 'exec $c'"| bash }
but it was not working.
To Reproduce
Steps to reproduce the behavior:
chsh to nu
Run gdb
gdb run
Expected behavior gdb run works fine.
Screenshots
Configuration (please complete the following information):
changed the title [-]nushell break gdb workflow because of the lack of buildin `exec` command[/-][+]nushell breaks gdb workflow because of the lack of buildin `exec` command[/+]on May 16, 2020
Since nushell is cross platform, and Windows doesn't have exec capabilities (cygwin did some funky things to emulate it), we didn't put any effort into adding an exec out of the box.
That doesn't mean it wouldn't be possible to add exec on platforms that support it though 🙂
This should be added, exec is NOT a command/program like ls and is supposed to be a part of any shell on *NIX according to the POSIX standard.
man exec says (shortened):
PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementa‐
tion of this interface may differ (consult the corresponding Linux manual page
for details of Linux behavior), or the interface may not be implemented on Linux.
NAME
exec — execute commands and open, close, or copy file descriptors
SYNOPSIS
exec [command [argument...]]
DESCRIPTION
The exec utility shall open, close, and/or copy file descriptors as specified by
any redirections as part of the command.
If exec is specified without command or arguments, and any file descriptors with
numbers greater than 2 are opened with associated redirection statements, it is
unspecified whether those file descriptors remain open when the shell invokes an‐
other utility. Scripts concerned that child shells could misuse open file de‐
scriptors can always close them explicitly, as shown in one of the following ex‐
amples.
If exec is specified with command, it shall replace the shell with command with‐
out creating a new process. If arguments are specified, they shall be arguments
to command. Redirection affects the current shell execution environment.
IEEE/The Open Group 2013 EXEC(1P)
Activity
[-]nushell break gdb workflow because of the lack of buildin `exec` command[/-][+]nushell breaks gdb workflow because of the lack of buildin `exec` command[/+]thegedge commentedon May 16, 2020
Since nushell is cross platform, and Windows doesn't have
execcapabilities (cygwin did some funky things to emulate it), we didn't put any effort into adding an exec out of the box.That doesn't mean it wouldn't be possible to add
execon platforms that support it though 🙂LesleyLai commentedon May 16, 2020
Yeah. I was shocked that gdb invokes the default shell rather than calls
execdirectly.almindor commentedon Sep 4, 2020
This should be added,
execis NOT a command/program likelsand is supposed to be a part of any shell on*NIXaccording to thePOSIXstandard.man execsays (shortened):thegedge commentedon Sep 5, 2020
This should be fixed by #2495. Reopen if you're still having problems.