Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work with redirected output? #17

Open
vogler opened this issue Sep 7, 2023 · 1 comment
Open

work with redirected output? #17

vogler opened this issue Sep 7, 2023 · 1 comment

Comments

@vogler
Copy link

vogler commented Sep 7, 2023

I have a script which redirects its output to a file.
After that line window-size errors reading 'height'.
Is there a way to circumvent this?

npx -y window-size # works fine
# save all output to file, see https://stackoverflow.com/questions/25833676/redirect-echo-output-in-shell-script-to-logfile
exec > >(tee $data/output/scan.log)
exec 2>&1
npx -y window-size # TypeError: Cannot read properties of undefined (reading 'height')
bash -c 'npx -y window-size; exit 0' # same
/root/.npm/_npx/dbb0fbeae5ae92a5/node_modules/window-size/cli.js:16
  console.log('height: ' + size.height);
                                ^

TypeError: Cannot read properties of undefined (reading 'height')
    at showSize (/root/.npm/_npx/dbb0fbeae5ae92a5/node_modules/window-size/cli.js:16:33)
    at Object.<anonymous> (/root/.npm/_npx/dbb0fbeae5ae92a5/node_modules/window-size/cli.js:27:5)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v20.5.1
@vogler
Copy link
Author

vogler commented Sep 7, 2023

Ok, one workaround is to prefix ROWS=50 COLUMNS=140 to manually set the size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant