Skip to content

nushell breaks gdb workflow because of the lack of buildin exec command #1799

Closed

Description

@LesleyLai

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:

  1. chsh to nu
  2. Run gdb
  3. gdb run

Expected behavior
gdb run works fine.

Screenshots
Screenshot_2020-05-15_18-05-07

Configuration (please complete the following information):

  • OS: Pop!_OS
  • Version 20.04
  • gdb 9.1

Activity

  1. 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
  2. thegedge commented on May 16, 2020

    @thegedge
    Contributor

    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 🙂

  3. added
    category:enhancement
    on May 16, 2020
  4. LesleyLai commented on May 16, 2020

    @LesleyLai
    Author

    Yeah. I was shocked that gdb invokes the default shell rather than calls exec directly.

  5. almindor commented on Sep 4, 2020

    @almindor
    Contributor

    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)
    
  6. thegedge commented on Sep 5, 2020

    @thegedge
    Contributor

    This should be fixed by #2495. Reopen if you're still having problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions