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

@cloudflare/wrangler postinstall script does not exit #3

Open
magicdawn opened this issue Feb 13, 2020 · 2 comments
Open

@cloudflare/wrangler postinstall script does not exit #3

magicdawn opened this issue Feb 13, 2020 · 2 comments
Labels
bug Something isn't working status - needs repro

Comments

@magicdawn
Copy link

image

I have to force exit, and the binary is not linked.

And I modified the script

#!/usr/bin/env node

const why = require('why-is-node-running')
const { install } = require("./binary");

install().then(() => {
  setInterval(() => {
    console.log('-------');
    why()
  }, 1000)
})

And logs as

$ node ./install-wrangler.js
Downloading release https://workers.cloudflare.com/get-npm-wrangler-binary/1.7.0/x86_64-apple-darwin
wrangler has been installed!
-------
There are 10 handle(s) keeping the process running

# TTYWRAP
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/debug/src/node.js:76        - : tty.isatty(process.stderr.fd);
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/debug/src/debug.js:120      - debug.useColors = exports.useColors();
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/follow-redirects/index.js:6 - var debug = require("debug")("follow-redirects");

# SIGNALWRAP
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/debug/src/node.js:76        - : tty.isatty(process.stderr.fd);
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/debug/src/debug.js:120      - debug.useColors = exports.useColors();
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/follow-redirects/index.js:6 - var debug = require("debug")("follow-redirects");

# TTYWRAP
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/binary-install/src/binary.js:88 - console.log("Downloading release", this.url);
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/binary.js:37                                 - return binary.install();

# TCPWRAP
(unknown stack trace)

# TLSWRAP
(unknown stack trace)

# DNSCHANNEL
(unknown stack trace)

# HTTPCLIENTREQUEST
(unknown stack trace)

# Timeout
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/install-wrangler.js:7 - setInterval(() => {

# ZLIB
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/minizlib/index.js:60  - this[_handle] = new realZlib[mode](opts)
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/minizlib/index.js:193 - super(opts, mode)
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/minizlib/index.js:292 - super(opts, 'Unzip')
/Users/magicdawn/.npm-global/lib/node_modules/@cloudflare/wrangler/node_modules/tar/lib/parse.js:347  - this[UNZIP] = new zlib.Unzip()

# TickObject
(unknown stack trace)
@xtuc
Copy link
Member

xtuc commented Feb 14, 2020

What happends if you download https://workers.cloudflare.com/get-npm-wrangler-binary/1.7.0/x86_64-apple-darwin and try to extract it?

@magicdawn
Copy link
Author

magicdawn commented Nov 27, 2020

this should resolve when WritableStream emit finish event.
https://github.com/cloudflare/binary-install/blob/master/packages/binary-install/src/binary.js#L95

there is a library built by me can be used for download

const dl = require('dl-vampire')

// cache is automatily applied, if the url response headers has a content-length to match the local file size.
await dl({ url, file }) 


// or if you have the file hash, you can provide the file hash for cache validating
await dl({ url, file, expectHash: 'blabla', expectHashAlgorithm: 'md5' })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status - needs repro
Projects
None yet
Development

No branches or pull requests

3 participants