Repository: xonsh/xonsh

Issue:
Unhandled exception
I have found the minimal way of how to reproduce the error but I'm not sure how to correctly describe what am I doing or am I using Xonsh as intended as I'm a new user. 

My practical use case is that I was trying to do something like `find ... | xargs @(lambda ...)`

## xonfig

<details>

```
+------------------+----------------------+
| xonsh            | 0.9.27               |
| Git SHA          | 8ad8b043             |
| Commit Date      | Mar 17 00:07:11 2021 |
| Python           | 3.9.1                |
| PLY              | 3.11                 |
| have readline    | True                 |
| prompt toolkit   | None                 |
| shell type       | none                 |
| pygments         | None                 |
| on posix         | True                 |
| on linux         | True                 |
| distro           | unknown              |
| on darwin        | False                |
| on windows       | False                |
| on cygwin        | False                |
| on msys2         | False                |
| is superuser     | False                |
| default encoding | utf-8                |
| xonsh encoding   | utf-8                |
| encoding errors  | surrogateescape      |
| on jupyter       | False                |
| jupyter kernel   | None                 |
| xontrib          | []                   |
+------------------+----------------------+
```

</details>

## Expected Behavior
No exception.

## Current Behavior
Exception.

### Traceback (if applicable)

<details>

```
Traceback (most recent call last):
  File "/home/andrei/projects/xonsh/xonsh/xonsh/procs/pipelines.py", line 160, in __init__
    proc = spec.run(pipeline_group=pipeline_group)
  File "/home/andrei/projects/xonsh/xonsh/xonsh/procs/specs.py", line 448, in run
    self._fix_null_cmd_bytes()
  File "/home/andrei/projects/xonsh/xonsh/xonsh/procs/specs.py", line 517, in _fix_null_cmd_bytes
    cmd[i] = cmd[i].replace("\0", "\\0")
AttributeError: 'function' object has no attribute 'replace'
```

</details>

## Steps to Reproduce
```
$ xonsh -DXONSH_SHOW_TRACEBACK=1 -c 'echo hello @(lambda args, stdin=None: "world")'
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "/home/andrei/projects/xonsh/xonsh/xonsh/procs/pipelines.py", line 160, in __init__
    proc = spec.run(pipeline_group=pipeline_group)
  File "/home/andrei/projects/xonsh/xonsh/xonsh/procs/specs.py", line 448, in run
    self._fix_null_cmd_bytes()
  File "/home/andrei/projects/xonsh/xonsh/xonsh/procs/specs.py", line 517, in _fix_null_cmd_bytes
    cmd[i] = cmd[i].replace("\0", "\\0")
AttributeError: 'function' object has no attribute 'replace'
```

## For community
⬇️  **Please click the 👍 reaction instead of leaving a `+1` or 👍  comment**



Discussion:

Resolving patch:
diff --git a/xonsh/procs/specs.py b/xonsh/procs/specs.py
--- a/xonsh/procs/specs.py
+++ b/xonsh/procs/specs.py
@@ -514,6 +514,8 @@ def _fix_null_cmd_bytes(self):
         # escape them just in case.
         cmd = self.cmd
         for i in range(len(cmd)):
+            if callable(cmd[i]):
+                raise Exception(f"The command contains callable argument: {cmd[i]}")
             cmd[i] = cmd[i].replace("\0", "\\0")
 
     def _cmd_event_name(self):


Test patch: