termux / termux/termux-api

termux-microphone-record should exit 1 if recording is already in progress or the file already exists

Open
#648 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.3k
Forks
920
PR merge metrics
No merged PRs in 30d

Description

Problem description

termux-microphone-record currently exits 0 even when:

  1. Recording already in progress!
  2. The file specified with -f already exists (File: fileb already exists! Please specify a different filename)

This makes &&, ||, and checking $? unusable.

Steps to reproduce

.../0/TODO_audio_files $ termux-microphone-record -f fileb
Recording started: /storage/emulated/0/TODO_audio_files/fileb
Max Duration: 15:00
.../0/TODO_audio_files $ termux-microphone-record -f fileb

File: fileb already exists! Please specify a different filename
.../0/TODO_audio_files $ echo $?
0
.../0/TODO_audio_files $ termux-microphone-record -f filec

Recording already in progress!
.../0/TODO_audio_files $ echo $?
0

Expected behavior

exit 1 for the mentioned situations

Additional information

  • termux-api application version:
  • termux-api package version (installed through apt):
  • Android OS version:
  • Device model:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=4741
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:

sources.list

deb https://packages.termux.org/apt/termux-main stable main

x11-repo (sources.list.d/x11.list)

deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
All packages up to date
termux-tools version:
1.39.6
Android version:
11
Kernel build information:
Linux localhost 4.4.223-g52750b8f2138-ab6846512 #1 SMP PREEMPT Fri Sep 18 09:49:34 UTC 2020 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 2
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.boot versionCode:7
com.termux.widget versionCode:13
com.termux.window versionCode:15

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the termux-microphone-record command and reproduce both cases from the issue: an existing output file and a recording already in progress. Verify the command's status with echo $?, and consider the work complete when each case exits with status 1 while normal recording behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
cli, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.