Skip to content

Commit

Permalink
Merge 960c906 into e73e559
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl authored Nov 18, 2023
2 parents e73e559 + 960c906 commit 998dd24
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
16 changes: 11 additions & 5 deletions src/modes/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function(verbosity = 0) {
// 10| 20| 30| 40| 50| 60| 70| | 80|
return undent`
usage:
pkgx [+pkg@x.y…] [program|path] [--] [arg…]
pkgx [+pkg@x.y…] <program|path> [--] [arg…]
examples:
05 $ pkgx node@18 --eval 'console.log("pkgx.sh")'
Expand All @@ -23,7 +23,7 @@ export default function(verbosity = 0) {
// 10| 20| 30| 40| 50| 60| 70| | 80|
return undent`
usage:
pkgx [+pkg~x.y…] [program|path] [--] [arg…]
pkgx [+pkg@x.y…] <program|path> [--] [arg…]
• assembles the requested environment, installing packages as necessary
• automatically determines additional packages based on the args
Expand All @@ -45,13 +45,19 @@ export default function(verbosity = 0) {
#§ silences pkgx, *not the executed program*
modes:
install <pkg…> #installs stubs to PATH
uninstall <pkg…> #uninstall stubs
integrate [--dry-run] #integrate with found shells
deintegrate [--dry-run] #deintegrates all shell integrations
alt. modes:
--help #hi mom!
--version #prints pkgx’s version
--provider [programs…] #prints provider(s); non-0 exit if none
--shell-completion [prefix] #prints completions for /prefix.*/
--provider <programs…> #prints provider(s); non-0 exit if none
--shell-completion <prefix> #prints completions for /prefix.*/
environments variables
environments variables:
PKGX_DIR #cache pkgs here, defaults to ~/.pkgx
VERBOSE #{-2: silent, -1: quietish, 0: default, 1: verbose, 2: debug}
DEBUG #alias for \`VERBOSE=2\`
Expand Down
1 change: 1 addition & 0 deletions src/modes/shellcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { flatmap } from "pkgx/utils/misc.ts";
// NOTES
// * is safely re-entrant (and idempotent)
// * we `eval` for BASH/ZSH because otherwise parsing fails for POSIX `sh`
// * we `eval` for conditional functions since weirdly zsh parses code it isn’t actually branching on
// * we add `~/.local/bin` to `PATH` because we eg `npm i -g` is configured to install there
// * `command_not_found_handler` cannot change the global environment hence we write a file

Expand Down
4 changes: 3 additions & 1 deletion src/utils/execve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ export class CStringArray extends Uint8Array {
// maximum bytes for a utf8 string is 4×length
stringsLength += string.length * 4 + 1;
}
super(8 * (strings.length + 1) + stringsLength);
// +1000 because we are getting macOS crashers we don’t understand and this is all
// we can think of that may cause it
super(8 * (strings.length + 1) + stringsLength + 1000);
const pointerBuffer = new BigUint64Array(this.buffer, 0, strings.length + 1);
const stringsBuffer = new Uint8Array(this.buffer).subarray(
(strings.length + 1) * 8,
Expand Down

0 comments on commit 998dd24

Please sign in to comment.