Skip to content

Commit

Permalink
Merge branch 'main' into tyriar/177232
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge authored Mar 17, 2023
2 parents cb17229 + abc1d14 commit ca8ab92
Show file tree
Hide file tree
Showing 108 changed files with 1,751 additions and 2,311 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@
"@vscode/vscode-languagedetection",
"@vscode/ripgrep",
"@vscode/iconv-lite-umd",
"@vscode/spdlog",
"@vscode/policy-watcher",
"@vscode/proxy-agent",
"assert",
"child_process",
"console",
Expand All @@ -248,15 +250,13 @@
"os",
"path",
"perf_hooks",
"spdlog",
"stream",
"string_decoder",
"tas-client-umd",
"tls",
"url",
"util",
"v8-inspect-profiler",
"vscode-proxy-agent",
"vscode-regexpp",
"vscode-textmate",
"windows-process-tree",
Expand Down
76 changes: 37 additions & 39 deletions build/.moduleignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# cleanup rules for node modules, .gitignore style

# native node modules
@parcel/watcher/binding.gyp
@parcel/watcher/build/**
@parcel/watcher/prebuilds/**
@parcel/watcher/src/**
!@parcel/watcher/build/Release/*.node

nan/**
*/node_modules/nan/**
@vscode/policy-watcher/build/**
@vscode/policy-watcher/.husky/**
@vscode/policy-watcher/src/**
@vscode/policy-watcher/binding.gyp
@vscode/policy-watcher/README.md
@vscode/policy-watcher/index.d.ts
!@vscode/policy-watcher/build/Release/vscode-policy-watcher.node

fsevents/binding.gyp
fsevents/fsevents.cc
fsevents/build/**
fsevents/src/**
fsevents/test/**
!fsevents/**/*.node
@vscode/spdlog/binding.gyp
@vscode/spdlog/build/**
@vscode/spdlog/deps/**
@vscode/spdlog/src/**
@vscode/spdlog/test/**
@vscode/spdlog/*.yml
!@vscode/spdlog/build/Release/*.node

@vscode/sqlite3/binding.gyp
@vscode/sqlite3/benchmark/**
Expand All @@ -21,15 +31,29 @@ fsevents/test/**
@vscode/sqlite3/src/**
!@vscode/sqlite3/build/Release/*.node

@vscode/windows-ca-certs/**/*
!@vscode/windows-ca-certs/package.json
!@vscode/windows-ca-certs/**/*.node

@vscode/windows-mutex/binding.gyp
@vscode/windows-mutex/build/**
@vscode/windows-mutex/src/**
!@vscode/windows-mutex/**/*.node

@vscode/windows-registry/binding.gyp
@vscode/windows-registry/src/**
@vscode/windows-registry/build/**
!@vscode/windows-registry/build/Release/*.node

windows-mutex/binding.gyp
windows-mutex/build/**
windows-mutex/src/**
!windows-mutex/**/*.node
nan/**
*/node_modules/nan/**

fsevents/binding.gyp
fsevents/fsevents.cc
fsevents/build/**
fsevents/src/**
fsevents/test/**
!fsevents/**/*.node

native-keymap/binding.gyp
native-keymap/build/**
Expand All @@ -53,14 +77,6 @@ node-vsce-sign/**
!node-vsce-sign/package.json
!node-vsce-sign/bin/**

spdlog/binding.gyp
spdlog/build/**
spdlog/deps/**
spdlog/src/**
spdlog/test/**
spdlog/*.yml
!spdlog/build/Release/*.node

windows-foreground-love/binding.gyp
windows-foreground-love/build/**
windows-foreground-love/src/**
Expand Down Expand Up @@ -90,12 +106,6 @@ node-pty/scripts/**
!node-pty/build/Release/*.dll
!node-pty/build/Release/*.node

@parcel/watcher/binding.gyp
@parcel/watcher/build/**
@parcel/watcher/prebuilds/**
@parcel/watcher/src/**
!@parcel/watcher/build/Release/*.node

vsda/build/**
vsda/ci/**
vsda/src/**
Expand All @@ -113,18 +123,6 @@ vscode-encrypt/binding.gyp
vscode-encrypt/README.md
!vscode-encrypt/build/Release/vscode-encrypt-native.node

@vscode/policy-watcher/build/**
@vscode/policy-watcher/.husky/**
@vscode/policy-watcher/src/**
@vscode/policy-watcher/binding.gyp
@vscode/policy-watcher/README.md
@vscode/policy-watcher/index.d.ts
!@vscode/policy-watcher/build/Release/vscode-policy-watcher.node

vscode-windows-ca-certs/**/*
!vscode-windows-ca-certs/package.json
!vscode-windows-ca-certs/**/*.node

node-addon-api/**/*
prebuild-install/**/*

Expand Down
2 changes: 0 additions & 2 deletions build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"@types/cssnano": "^4.0.0",
"@types/debounce": "^1.0.0",
"@types/debug": "4.1.5",
"@types/eslint": "4.16.1",
"@types/fancy-log": "^1.3.0",
"@types/fs-extra": "^9.0.12",
"@types/glob": "^7.1.1",
Expand All @@ -38,7 +37,6 @@
"@types/through2": "^2.0.36",
"@types/tmp": "^0.2.1",
"@types/underscore": "^1.8.9",
"@types/webpack": "^4.41.25",
"@types/xml2js": "0.0.33",
"@vscode/iconv-lite-umd": "0.7.0",
"@vscode/vsce": "^2.16.0",
Expand Down
65 changes: 2 additions & 63 deletions build/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,6 @@
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==

"@types/eslint@4.16.1":
version "4.16.1"
resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-4.16.1.tgz#19730c9fcb66b6e44742d12b27a603fabfeb2f49"
integrity sha512-lRUXQAULl5geixTiP2K0iYvMUbCkEnuOwvLGjwff12I4ECxoW5QaWML5UUOZ1CvpQLILkddBdMPMZz4ByQizsg==
dependencies:
"@types/estree" "*"
"@types/json-schema" "*"

"@types/estree@*":
version "0.0.41"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.41.tgz#fd90754150b57432b72bf560530500597ff04421"
integrity sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA==

"@types/events@*":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86"
Expand Down Expand Up @@ -449,11 +436,6 @@
resolved "https://registry.yarnpkg.com/@types/js-beautify/-/js-beautify-1.8.0.tgz#0369d3d0e1f35a6aec07cb4da2ee2bcda111367c"
integrity sha512-/siF86XrwDKLuHe8l7h6NhrAWgLdgqbxmjZv9NvGWmgYRZoTipkjKiWb0SQHy/jcR+ee0GvbG6uGd+LEBMGNvA==

"@types/json-schema@*":
version "7.0.4"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==

"@types/keyv@*":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.1.tgz#e45a45324fca9dab716ab1230ee249c9fb52cfa7"
Expand Down Expand Up @@ -545,16 +527,6 @@
"@types/glob" "*"
"@types/node" "*"

"@types/source-list-map@*":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==

"@types/tapable@^1":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.8.tgz#b94a4391c85666c7b73299fd3ad79d4faa435310"
integrity sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ==

"@types/through2@^2.0.36":
version "2.0.36"
resolved "https://registry.yarnpkg.com/@types/through2/-/through2-2.0.36.tgz#35fda0db635827d44c0e08e2c94653e647574a00"
Expand Down Expand Up @@ -586,13 +558,6 @@
dependencies:
"@types/node" "*"

"@types/uglify-js@*":
version "3.13.1"
resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.13.1.tgz#5e889e9e81e94245c75b6450600e1c5ea2878aea"
integrity sha512-O3MmRAk6ZuAKa9CHgg0Pr0+lUOqoMLpc9AS4R8ano2auvsg7IE8syF3Xh/NPr26TWklxYcqoEEFdzLLs1fV9PQ==
dependencies:
source-map "^0.6.1"

"@types/underscore@^1.8.9":
version "1.8.9"
resolved "https://registry.yarnpkg.com/@types/underscore/-/underscore-1.8.9.tgz#fef41f800cd23db1b4f262ddefe49cd952d82323"
Expand Down Expand Up @@ -628,27 +593,6 @@
dependencies:
"@types/node" "*"

"@types/webpack-sources@*":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-2.1.1.tgz#6af17e3a3ded71eec2b98008d7c12f498a0a4506"
integrity sha512-MjM1R6iuw8XaVbtkCBz0N349cyqBjJHCbQiOeppe3VBeFvxqs74RKHAVt9LkxTnUWc7YLZOEsUfPUnmK6SBPKQ==
dependencies:
"@types/node" "*"
"@types/source-list-map" "*"
source-map "^0.7.3"

"@types/webpack@^4.41.25":
version "4.41.30"
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.30.tgz#fd3db6d0d41e145a8eeeafcd3c4a7ccde9068ddc"
integrity sha512-GUHyY+pfuQ6haAfzu4S14F+R5iGRwN6b2FRNJY7U0NilmFAqbsOfK6j1HwuLBAqwRIT+pVdNDJGJ6e8rpp0KHA==
dependencies:
"@types/node" "*"
"@types/tapable" "^1"
"@types/uglify-js" "*"
"@types/webpack-sources" "*"
anymatch "^3.0.0"
source-map "^0.6.0"

"@types/xml2js@0.0.33":
version "0.0.33"
resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.0.33.tgz#20c5dd6460245284d64a55690015b95e409fb7de"
Expand Down Expand Up @@ -748,7 +692,7 @@ ansi-wrap@0.1.0, ansi-wrap@^0.1.0:
resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf"
integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768=

anymatch@^3.0.0, anymatch@^3.1.1, anymatch@~3.1.1:
anymatch@^3.1.1, anymatch@~3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"
integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==
Expand Down Expand Up @@ -2881,16 +2825,11 @@ simple-get@^4.0.0:
once "^1.3.1"
simple-concat "^1.0.0"

source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1:
source-map@0.6.1, source-map@^0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==

source-map@^0.7.3:
version "0.7.3"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==

sprintf-js@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673"
Expand Down
1 change: 1 addition & 0 deletions cli/src/bin/code/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ async fn main() -> Result<(), std::convert::Infallible> {
Some(args::TunnelSubcommand::Unregister) => tunnels::unregister(context).await,
Some(args::TunnelSubcommand::Kill) => tunnels::kill(context).await,
Some(args::TunnelSubcommand::Restart) => tunnels::restart(context).await,
Some(args::TunnelSubcommand::Status) => tunnels::status(context).await,
Some(args::TunnelSubcommand::Rename(rename_args)) => {
tunnels::rename(context, rename_args).await
}
Expand Down
3 changes: 3 additions & 0 deletions cli/src/commands/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@ pub enum TunnelSubcommand {
/// Restarts any running tunnel on the system.
Restart,

/// Gets whether there is a tunnel running on the current machineiou.
Status,

/// Rename the name of this machine associated with port forwarding service.
Rename(TunnelRenameArgs),

Expand Down
50 changes: 31 additions & 19 deletions cli/src/commands/tunnels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use super::{
use crate::{
async_pipe::socket_stream_split,
auth::Auth,
constants::APPLICATION_NAME,
json_rpc::{new_json_rpc, start_json_rpc},
log::{self, Logger},
singleton::connect_as_client,
Expand Down Expand Up @@ -138,7 +139,7 @@ pub async fn service(
],
)
.await?;
ctx.log.result("Service successfully installed! You can use `code tunnel service log` to monitor it, and `code tunnel service uninstall` to remove it.");
ctx.log.result(format!("Service successfully installed! You can use `{} tunnel service log` to monitor it, and `code tunnel service uninstall` to remove it.", APPLICATION_NAME));
}
TunnelServiceSubCommands::Uninstall => {
manager.unregister().await?;
Expand Down Expand Up @@ -203,17 +204,19 @@ pub async fn unregister(ctx: CommandContext) -> Result<i32, AnyError> {
Ok(0)
}

async fn do_single_rpc_call(
ctx: CommandContext,
async fn do_single_rpc_call<
P: serde::Serialize,
R: serde::de::DeserializeOwned + Send + 'static,
>(
ctx: &CommandContext,
method: &'static str,
params: impl serde::Serialize,
) -> Result<i32, AnyError> {
params: P,
) -> Result<R, AnyError> {
let client = match connect_as_client(&ctx.paths.tunnel_lockfile()).await {
Ok(p) => p,
Err(CodeError::SingletonLockfileOpenFailed(_))
| Err(CodeError::SingletonLockedProcessExited(_)) => {
error!(ctx.log, "No tunnel is running");
return Ok(1);
return Err(CodeError::NoRunningTunnel.into());
}
Err(e) => return Err(e.into()),
};
Expand All @@ -236,33 +239,42 @@ async fn do_single_rpc_call(
.unwrap();
});

let r = caller.call::<_, _, ()>(method, params).await.unwrap();
let r = caller.call(method, params).await.unwrap();
rpc.abort();

if let Err(r) = r {
error!(ctx.log, "RPC call failed: {:?}", r);
return Ok(1);
}

Ok(0)
r.map_err(|err| CodeError::TunnelRpcCallFailed(err).into())
}

pub async fn restart(ctx: CommandContext) -> Result<i32, AnyError> {
do_single_rpc_call(
ctx,
do_single_rpc_call::<_, ()>(
&ctx,
protocol::singleton::METHOD_RESTART,
protocol::EmptyObject {},
)
.await
.map(|_| 0)
}

pub async fn kill(ctx: CommandContext) -> Result<i32, AnyError> {
do_single_rpc_call(
ctx,
do_single_rpc_call::<_, ()>(
&ctx,
protocol::singleton::METHOD_SHUTDOWN,
protocol::EmptyObject {},
)
.await
.map(|_| 0)
}

pub async fn status(ctx: CommandContext) -> Result<i32, AnyError> {
let status: protocol::singleton::Status = do_single_rpc_call(
&ctx,
protocol::singleton::METHOD_STATUS,
protocol::EmptyObject {},
)
.await?;

ctx.log.result(serde_json::to_string(&status).unwrap());

Ok(0)
}

/// Removes unused servers.
Expand Down
Loading

0 comments on commit ca8ab92

Please sign in to comment.