Skip to content

Commit

Permalink
remove require out of functions (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
yungezz authored Apr 9, 2019
1 parent 77e33f4 commit 2610005
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/azureHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import * as vscode from 'vscode';
import { Constants } from './constants';
import * as utilities from './utilities';
var https = require('https');

export class AzureHelpers {
constructor() {
Expand All @@ -23,8 +24,6 @@ export class AzureHelpers {
}

// XXX - check if credentials are valid

var https = require('https');
let __this = this;

let postData: string = "resource=https%3A%2F%2Fmanagement.core.windows.net%2F&client_id=" + azure_client_id + "&grant_type=client_credentials&client_secret=" + azure_secret;
Expand Down
3 changes: 2 additions & 1 deletion src/dockerRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { TelemetryClient } from './telemetryClient';
import { clearInterval } from 'timers';
import { TerminalBaseRunner } from './terminalBaseRunner';
import * as fsExtra from 'fs-extra';
import * as child_process from 'child_process';


export class DockerRunner extends TerminalBaseRunner {
Expand Down Expand Up @@ -105,7 +106,7 @@ export class DockerRunner extends TerminalBaseRunner {
private startTerminal(terminalId: string, initCmd: string, terminalName: string, waitAfterInit: boolean, subCmds: string[], interval: number, reuse: boolean): void {
TerminalExecutor.runInTerminal(initCmd, terminalName, waitAfterInit, subCmds, interval, reuse, function (terminal, interval) {
if (terminal) {
require('child_process').exec('docker ps --filter name=' + terminalId, (err, stdout, stderr) => {
child_process.exec('docker ps --filter name=' + terminalId, (err, stdout, stderr) => {
if (err || stderr) {
console.log('err: ' + err + ' ' + stderr);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/restSamples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { PlaybookManager } from './playbookManager';
import * as utilities from './utilities';
var path = require("path");
var fs = require('fs');
var clone = require('git-clone');
var pm = new PlaybookManager();

export class RestSamples {
Expand Down Expand Up @@ -91,7 +92,6 @@ export class RestSamples {
const progress = utilities.delayedInterval(() => { this._outputChannel.append('.') }, 500);

this._outputChannel.append("Getting Azure REST API specifications.");
let clone = require('git-clone');
//let home: string = path.join(vscode.extensions.getExtension("vscoss.vscode-ansible").extensionPath, 'azure-rest-api-specs');
let home = path.join(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], '.vscode', 'rest');
clone("https://github.com/Azure/azure-rest-api-specs.git", home, null, (result) => {
Expand Down
3 changes: 2 additions & 1 deletion src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import { SSHServer } from './interfaces';
import * as scp from 'scp2';
import { clearInterval } from 'timers';
import * as ssh from 'ssh2';
import * as childprocess from 'child_process';

const sshConfigFile = path.join(os.homedir(), '.ssh', 'servers.json');

export function localExecCmd(cmd: string, args: string[], outputChannel: vscode.OutputChannel, cb: Function): void {
try {
var cp = require('child_process').spawn(cmd, args);
var cp = childprocess.spawn(cmd, args);

cp.stdout.on('data', function (data) {
if (outputChannel) {
Expand Down

0 comments on commit 2610005

Please sign in to comment.