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

Fix running under docker #5135

Merged
merged 2 commits into from
Apr 5, 2019
Merged

Fix running under docker #5135

merged 2 commits into from
Apr 5, 2019

Conversation

rchiodo
Copy link

@rchiodo rchiodo commented Apr 5, 2019

For #5047

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Has a news entry file (remember to thank yourself!)
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated
  • Test plan is updated as appropriate
  • package-lock.json has been regenerated by running npm install (if dependencies have changed)
  • The wiki is updated with any design decisions/details.

@rchiodo rchiodo requested review from DonJayamanne and greazer April 5, 2019 22:16
@rchiodo rchiodo self-assigned this Apr 5, 2019
@@ -351,6 +352,24 @@ export class JupyterExecutionBase implements IJupyterExecution {
extraArgs.push('--debug');
}

// Check for a docker situation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this file jupyterExecution.ts is just too large, including something as simple as this if may simple and just a few lines, however the file just grows and now does a tonne of things..

extraArgs.push('127.0.0.1');

// Now see if we need --allow-root.
const idResults = execSync('id', {encoding: 'utf-8'});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we've got unit tests for this, if we're using execSync

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope no unit tests for this. Functional tests will attempt the lines before it though

@@ -351,6 +352,24 @@ export class JupyterExecutionBase implements IJupyterExecution {
extraArgs.push('--debug');
}

// Check for a docker situation.
try {
const cgroup = await this.fileSystem.readFile('/proc/self/cgroup');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More curiosity than a problem, but I would assume that this line will throw if the file can't be read. Basically we're using readFile to test for existence before reading the file. Is this a common way to do it? I would think you'd do an fs.exists and then read it if it exists.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems like a good idea to me. I'll do that

@rchiodo rchiodo merged commit e17c0d2 into master Apr 5, 2019
@rchiodo rchiodo deleted the rchiodo/fix_docker branch April 5, 2019 23:06
@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants