Commit graph

23 commits

Author SHA1 Message Date
Uriel Corfa
4e894dd0fd
init-posix: preserve arguments when exec'ing the original_cmd 2026-01-08 09:56:59 +01:00
Uriel Corfa
3bfca9e296
Propagate command-not-found errors when invoking wrapped commands
Before this change, if a package manager was not installed, safe-chain still
sets the function and when invoked, the wrapper will invoke safe-chain, which
will exit with error code 127 when it fails to invoke the wrapped command. As an
example (with a shell prompt that shows $? when non-zero):

```
$ type -f pip
bash: type: pip: not found
1$ pip
127$
```

With this patch, the wrapper first checks for the existence of the wrapped
command (ignoring functions), and if no such command exists, it instructs the
shell to invoke it anyway. This results in the shell failing to find the
command, and reporting an error as if the wrapper function wasn't there:

```
$ source init-posix.sh
$ type -f pip
bash: type: pip: not found
1$ pip
Command 'pip' not found, but can be installed with:
sudo apt install python3-pip
127$
```
2026-01-07 17:18:48 +01:00
Graeme Chapman
c510d886a9
Simplify command execution in init-posix.sh 2025-12-31 10:57:08 +00:00
Graeme Chapman
a0e19818a0
fix: Allow running commands if safe-chain npm package is not installed 2025-12-31 10:18:58 +00:00
Reinier Criel
d2fc531c81 Fix tests and add command support 2025-12-18 10:33:31 +01:00
Reinier Criel
7e460e50e1 Skeleton 2025-12-15 15:06:00 +01:00
Sander Declerck
4139275b76
Handle PR comments 2025-12-03 10:54:49 +01:00
Sander Declerck
edec6ec57c
Update shell scripts 2025-11-28 16:51:39 +01:00
Sander Declerck
f1ee6567df
Fix __dirname for esm / fix e2e tests. 2025-11-28 12:57:48 +01:00
Sander Declerck
c6bcd6f646
Add feature flag in setup for python support. 2025-11-14 14:12:44 +01:00
Reinier Criel
61a53b24fd Some cleanup 2025-11-06 13:24:00 -08:00
Reinier Criel
e88aede939 Remove some debug logging 2025-11-06 12:25:55 -08:00
Reinier Criel
f400c5576a WIP 2025-11-06 08:32:25 -08:00
Reinier Criel
ccd59a2f17 Clean up code 2025-10-28 09:45:24 -07:00
Reinier Criel
c2e632ead2 Add e2e test for malware blocking + python3 fix 2025-10-28 09:15:00 -07:00
Reinier Criel
a438175e8a Fix tests 2025-10-27 13:28:35 -07:00
Reinier Criel
57bbb06f39 Add redirecting for explicit python(3) commands 2025-10-27 13:00:18 -07:00
Reinier Criel
190607de92 Adapt per review 2025-10-27 09:23:47 -07:00
Reinier Criel
f817bf887a Update documentation 2025-10-23 10:23:42 -07:00
Reinier Criel
f086aeb2be Skeleton 2025-10-22 06:59:32 -07:00
Reinier Criel
d0f2edec0a Skeleton 2025-10-21 15:25:12 -07:00
Sander Declerck
43dcba8802
Wrap bun with safe-chain to block downloads of packages with malware 2025-10-08 15:12:06 +02:00
Sander Declerck
7673d32912
Move safe-chain package to packages/safe-chain 2025-09-05 11:19:37 +02:00
Renamed from src/shell-integration/startup-scripts/init-posix.sh (Browse further)