Skip to content

Commit 395e78d

Browse files
committed
[rust] Reset env DISPLAY
1 parent 6633fbb commit 395e78d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ build --test_output=errors
8282

8383
test --test_env=CI
8484
test --test_env=DASHBOARD_URL
85-
test --test_env=DISPLAY=":99"
85+
test --test_env=DISPLAY
8686
test --test_env=FIREFOX_NIGHTLY_BINARY
8787
test --test_env=GITHUB_ACTIONS
8888
test --test_env=MOZ_HEADLESS

rust/src/ffmpeg.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::config::OS::{MACOS, WINDOWS};
18+
use crate::config::OS::{LINUX, MACOS, WINDOWS};
1919
use crate::downloads::download_to_tmp_folder;
2020
use crate::files::{
2121
compose_driver_path_in_cache, create_parent_path_if_not_exists, get_filename_with_extension,
@@ -43,8 +43,9 @@ const FFMPEG_LINUX_RELEASE_URL: &str = "https://github.com/BtbN/FFmpeg-Builds/re
4343
const FFMPEG_MACOS_RELEASE_URL: &str = "https://evermeet.cx/ffmpeg/ffmpeg-{}.zip";
4444
const FFMPEG_RECORD_FRAME_RATE: &str = "30";
4545
const FFMPEG_RECORD_DESKTOP_WINDOWS_COMMAND: &str = "{} -f gdigrab -i desktop -r {} -q:v 1 -y {}";
46-
const FFMPEG_RECORD_DESKTOP_LINUX_COMMAND: &str = "{} -f x11grab -i {}:0 -r {} -vcodec huffyuv -y {}";
47-
const FFMPEG_RECORD_DESKTOP_MACOS_COMMAND: &str = r#"{} -f avfoundation -i "{}:0" -r {} -y {}"#;
46+
const FFMPEG_RECORD_DESKTOP_LINUX_COMMAND: &str =
47+
"{} -f x11grab -i {}:0 -r {} -vcodec huffyuv -y {}";
48+
const FFMPEG_RECORD_DESKTOP_MACOS_COMMAND: &str = r#"{} -f avfoundation -i "0:0" -r {} -y {}"#;
4849
const FFMPEG_RECORDING_EXTENSION: &str = "avi";
4950
const FFMPEG_RECORDING_FOLDER: &str = "recordings";
5051

@@ -209,19 +210,19 @@ pub fn record_desktop_with_ffmpeg(
209210
"Recording desktop with {} to {}",
210211
FFMPEG_NAME, &recording_name
211212
));
212-
let command = if WINDOWS.is(os) {
213-
Command::new_single(format_three_args(
213+
let command = if LINUX.is(os) {
214+
let env_display = env::var(ENV_DISPLAY).unwrap_or_default();
215+
Command::new_single(format_four_args(
214216
get_recording_command(os),
215217
&path_to_string(&ffmpeg_path),
218+
&env_display,
216219
FFMPEG_RECORD_FRAME_RATE,
217220
&recording_name,
218221
))
219222
} else {
220-
let env_display = env::var(ENV_DISPLAY).unwrap_or_default();
221-
Command::new_single(format_four_args(
223+
Command::new_single(format_three_args(
222224
get_recording_command(os),
223225
&path_to_string(&ffmpeg_path),
224-
&env_display,
225226
FFMPEG_RECORD_FRAME_RATE,
226227
&recording_name,
227228
))

0 commit comments

Comments
 (0)